package com.tuanzi.loan.web.lazy.system;

import org.springframework.data.domain.Page;

import com.tuanzi.loan.core.lazy.BaseLazyDataModel;
import com.tuanzi.loan.core.util.SpringContextHolder;
import com.tuanzi.loan.core.vo.PageSearcher;
import com.tuanzi.loan.vo.request.system.ProcessInstanceSearchRequest;
import com.tuanzi.loan.workflow.service.WorkflowProcessorService;
import com.tuanzi.loan.workflow.vo.ProcessInstanceResponse;

/**
 * @author Ray 2017/09/21
 */
public class WorkflowProcessInstanceLazyDataModel extends BaseLazyDataModel<ProcessInstanceSearchRequest, ProcessInstanceResponse> {

	private WorkflowProcessorService workflowProcessorService = SpringContextHolder.getBean(WorkflowProcessorService.class);
	private static final long serialVersionUID = -4670419347550704982L;

	public WorkflowProcessInstanceLazyDataModel(ProcessInstanceSearchRequest searchRequest) {
		super(searchRequest);
	}

	@Override
	protected Page<ProcessInstanceResponse> doLoad(PageSearcher<ProcessInstanceSearchRequest> pageSearcher) {
		return workflowProcessorService.listProcessInstance(pageSearcher);
	}
}
